package com.hz.house.controller.home;

import com.hz.house.common.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hz.house.bean.vo.BuildingSearchConditionBean;
import com.hz.house.bean.vo.DistaceSearchInfo;
import com.hz.house.bean.vo.FastFindBuildingCondition;
import com.hz.house.bean.vo.TagSearchCondition;
import com.hz.house.service.home.BuildingSearchService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api("楼盘搜索接口")
@RestController
@RequestMapping("/api/v2/search")
public class BuildingSearchController {

	@Autowired
	private BuildingSearchService search;
	
	
	/**
	 *  普通的楼盘搜索的接口
	 * @param condition
	 * @return
	 */
	@ApiOperation(value = "普通的楼盘搜索接口")
	@PostMapping("/generalSearch")
	public Object generalSearch(@RequestBody BuildingSearchConditionBean condition) {
		return search.generalSearch(condition);
	}
	
	
	@ApiOperation(value = "标签找房检索接口")
	@PostMapping("/tagSearch")
	public Object tagSearch(@RequestBody TagSearchCondition conditon) {
		return search.tagSearch(conditon.getTags(),conditon.getPage());
	}
	
	@ApiOperation("一键找房")
	@PostMapping("fastSearch")
	public Object fastSearch(@RequestBody FastFindBuildingCondition condition) {
		return search.fastSearch(condition);
	}
	
	@ApiOperation(value = "半径找房接口")
	@PostMapping("/distanceSearch")
	public Object banJingZhaoFang(@RequestBody DistaceSearchInfo info) {
		return this.search.banJingZhaoFang(info);
	}

	@ApiOperation(value = "优惠楼盘搜索")
	@PostMapping("/discountSearch")
	public Object discountSearch(@RequestBody BuildingSearchConditionBean condition) {
		return search.discountSearch(condition);
	}
}
